home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / doom / quake.zip / KASCAM17.ZIP / SOURCE / CLIENT.QC < prev    next >
Text File  |  1997-05-25  |  41KB  |  1,481 lines

  1.  
  2. // prototypes
  3. void () W_WeaponFrame;
  4. void() W_SetCurrentAmmo;
  5. void() player_pain;
  6. void() player_stand1;
  7. void (vector org) spawn_tfog;
  8. void (vector org, entity death_owner) spawn_tdeath;
  9.  
  10. float   modelindex_eyes, modelindex_player;
  11.  
  12. /*
  13. =============================================================================
  14.  
  15.                 LEVEL CHANGING / INTERMISSION
  16.  
  17. =============================================================================
  18. */
  19.  
  20. float   intermission_running;
  21. float   intermission_exittime;
  22.  
  23. /*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
  24. This is the camera point for the intermission.
  25. Use mangle instead of angle, so you can set pitch or roll as well as yaw.  'pitch roll yaw'
  26. */
  27. void() info_intermission =
  28. {
  29. };
  30.  
  31.  
  32.  
  33. void() SetChangeParms =
  34. {
  35.     if (self.health <= 0)
  36.     {
  37.         SetNewParms ();
  38.         return;
  39.     }
  40.  
  41. // remove items
  42.     self.items = self.items - (self.items &
  43.     (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
  44.  
  45. // cap super health
  46.     if (self.health > 100)
  47.         self.health = 100;
  48.     if (self.health < 50)
  49.         self.health = 50;
  50.     parm1 = self.items;
  51.     parm2 = self.health;
  52.     parm3 = self.armorvalue;
  53.     if (self.ammo_shells < 25)
  54.         parm4 = 25;
  55.     else
  56.         parm4 = self.ammo_shells;
  57.     parm5 = self.ammo_nails;
  58.     parm6 = self.ammo_rockets;
  59.     parm7 = self.ammo_cells;
  60.     parm8 = self.weapon;
  61.     parm9 = self.armortype * 100;
  62. };
  63.  
  64. void() SetNewParms =
  65. {
  66.     parm1 = IT_SHOTGUN | IT_AXE;
  67.     parm2 = 100;
  68.     parm3 = 0;
  69.     parm4 = 25;
  70.     parm5 = 0;
  71.     parm6 = 0;
  72.     parm7 = 0;
  73.     parm8 = 1;
  74.     parm9 = 0;
  75. };
  76.  
  77. void() DecodeLevelParms =
  78. {
  79.     if (serverflags)
  80.     {
  81.         if (world.model == "maps/start.bsp")
  82.             SetNewParms ();     // take away all stuff on starting new episode
  83.     }
  84.  
  85.     self.items = parm1;
  86.     self.health = parm2;
  87.     self.armorvalue = parm3;
  88.     self.ammo_shells = parm4;
  89.     self.ammo_nails = parm5;
  90.     self.ammo_rockets = parm6;
  91.     self.ammo_cells = parm7;
  92.     self.weapon = parm8;
  93.     self.armortype = parm9 * 0.01;
  94. };
  95.  
  96. /*
  97. ============
  98. FindIntermission
  99.  
  100. Returns the entity to view from
  101. ============
  102. */
  103. entity() FindIntermission =
  104. {
  105.     local   entity spot;
  106.     local   float cyc;
  107.  
  108. // look for info_intermission first
  109.     spot = find (world, classname, "info_intermission");
  110.     if (spot)
  111.     {   // pick a random one
  112.         cyc = random() * 4;
  113.         while (cyc > 1)
  114.         {
  115.             spot = find (spot, classname, "info_intermission");
  116.             if (!spot)
  117.                 spot = find (spot, classname, "info_intermission");
  118.             cyc = cyc - 1;
  119.         }
  120.         return spot;
  121.     }
  122.  
  123. // then look for the start position
  124.     spot = find (world, classname, "info_player_start");
  125.     if (spot)
  126.         return spot;
  127.  
  128. // testinfo_player_start is only found in regioned levels
  129.     spot = find (world, classname, "testplayerstart");
  130.     if (spot)
  131.         return spot;
  132.  
  133.     objerror ("FindIntermission: no spot");
  134. };
  135.  
  136.  
  137. string nextmap;
  138. void() GotoNextMap =
  139. {
  140.     if (cvar("samelevel"))  // if samelevel is set, stay on same level
  141.         changelevel (mapname);
  142.     else
  143.         changelevel (nextmap);
  144. };
  145.  
  146.  
  147. void() ExitIntermission =
  148. {
  149. // skip any text in deathmatch
  150.     if (deathmatch)
  151.     {
  152.         GotoNextMap ();
  153.         return;
  154.     }
  155.  
  156.     intermission_exittime = time + 1;
  157.     intermission_running = intermission_running + 1;
  158.  
  159. //
  160. // run some text if at the end of an episode
  161. //
  162.     if (intermission_running == 2)
  163.     {
  164.         if (world.model == "maps/e1m7.bsp")
  165.         {
  166.             WriteByte (MSG_ALL, SVC_CDTRACK);
  167.             WriteByte (MSG_ALL, 2);
  168.             WriteByte (MSG_ALL, 3);
  169.             if (!cvar("registered"))
  170.             {
  171.                 WriteByte (MSG_ALL, SVC_FINALE);
  172.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
  173.             }
  174.             else
  175.             {
  176.                 WriteByte (MSG_ALL, SVC_FINALE);
  177.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
  178.             }
  179.             return;
  180.         }
  181.         else if (world.model == "maps/e2m6.bsp")
  182.         {
  183.             WriteByte (MSG_ALL, SVC_CDTRACK);
  184.             WriteByte (MSG_ALL, 2);
  185.             WriteByte (MSG_ALL, 3);
  186.  
  187.             WriteByte (MSG_ALL, SVC_FINALE);
  188.             WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
  189.             return;
  190.         }
  191.         else if (world.model == "maps/e3m6.bsp")
  192.         {
  193.             WriteByte (MSG_ALL, SVC_CDTRACK);
  194.             WriteByte (MSG_ALL, 2);
  195.             WriteByte (MSG_ALL, 3);
  196.  
  197.             WriteByte (MSG_ALL, SVC_FINALE);
  198.             WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
  199.             return;
  200.         }
  201.         else if (world.model == "maps/e4m7.bsp")
  202.         {
  203.             WriteByte (MSG_ALL, SVC_CDTRACK);
  204.             WriteByte (MSG_ALL, 2);
  205.             WriteByte (MSG_ALL, 3);
  206.  
  207.             WriteByte (MSG_ALL, SVC_FINALE);
  208.             WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
  209.             return;
  210.         }
  211.  
  212.         GotoNextMap();
  213.     }
  214.  
  215.     if (intermission_running == 3)
  216.     {
  217.         if (!cvar("registered"))
  218.         {   // shareware episode has been completed, go to sell screen
  219.             WriteByte (MSG_ALL, SVC_SELLSCREEN);
  220.             return;
  221.         }
  222.  
  223.         if ( (serverflags&15) == 15)
  224.         {
  225.             WriteByte (MSG_ALL, SVC_FINALE);
  226.             WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
  227.             return;
  228.         }
  229.  
  230.     }
  231.  
  232.     GotoNextMap();
  233. };
  234.  
  235. /*
  236. ============
  237. IntermissionThink
  238.  
  239. When the player presses attack or jump, change to the next level
  240. ============
  241. */
  242. void() IntermissionThink =
  243. {
  244.     if (time < intermission_exittime)
  245.         return;
  246.  
  247.     if (!self.button0 && !self.button1 && !self.button2)
  248.         return;
  249.  
  250.     ExitIntermission ();
  251. };
  252.  
  253. void() execute_changelevel =
  254. {
  255.     local entity    pos;
  256.  
  257.     intermission_running = 1;
  258.  
  259. // enforce a wait time before allowing changelevel
  260.     if (deathmatch)
  261.         intermission_exittime = time + 5;
  262.     else
  263.         intermission_exittime = time + 2;
  264.  
  265.     WriteByte (MSG_ALL, SVC_CDTRACK);
  266.     WriteByte (MSG_ALL, 3);
  267.     WriteByte (MSG_ALL, 3);
  268.  
  269.     pos = FindIntermission ();
  270.  
  271.     other = find (world, classname, "player");
  272.     while (other != world)
  273.     {
  274.         other.view_ofs = '0 0 0';
  275.         other.angles = other.v_angle = pos.mangle;
  276.         other.fixangle = TRUE;      // turn this way immediately
  277.         other.nextthink = time + 0.5;
  278.         other.takedamage = DAMAGE_NO;
  279.         other.solid = SOLID_NOT;
  280.         other.movetype = MOVETYPE_NONE;
  281.         other.modelindex = 0;
  282.         setorigin (other, pos.origin);
  283.         other = find (other, classname, "player");
  284.     }
  285.  
  286.     WriteByte (MSG_ALL, SVC_INTERMISSION);
  287. };
  288.  
  289.  
  290. void() changelevel_touch =
  291. {
  292.     local entity    pos;
  293.  
  294.     if (other.classname != "player")
  295.         return;
  296.  
  297.     if ((cvar("noexit") == 1) || ((cvar("noexit") == 2) && (mapname != "start")))
  298.     {
  299.         T_Damage (other, self, self, 50000);
  300.         return;
  301.     }
  302.  
  303.     if (coop || deathmatch)
  304.     {
  305.         bprint (other.netname);
  306.         bprint (" exited the level\n");
  307.     }
  308.  
  309.     nextmap = self.map;
  310.  
  311.     SUB_UseTargets ();
  312.  
  313.     if ( (self.spawnflags & 1) && (deathmatch == 0) )
  314.     {   // NO_INTERMISSION
  315.         GotoNextMap();
  316.         return;
  317.     }
  318.  
  319.     self.touch = SUB_Null;
  320.  
  321. // we can't move people right now, because touch functions are called
  322. // in the middle of C movement code, so set a think time to do it
  323.     self.think = execute_changelevel;
  324.     self.nextthink = time + 0.1;
  325. };
  326.  
  327. /*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
  328. When the player touches this, he gets sent to the map listed in the "map" variable.  Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
  329. */
  330. void() trigger_changelevel =
  331. {
  332.     if (!self.map)
  333.         objerror ("chagnelevel trigger doesn't have map");
  334.  
  335.     InitTrigger ();
  336.     self.touch = changelevel_touch;
  337. };
  338.  
  339.  
  340. /*
  341. =============================================================================
  342.  
  343.                 PLAYER GAME EDGE FUNCTIONS
  344.  
  345. =============================================================================
  346. */
  347.  
  348. void() set_suicide_frame;
  349.  
  350. // called by ClientKill and DeadThink
  351. void() respawn =
  352. {
  353.     if (coop)
  354.     {
  355.         // make a copy of the dead body for appearances sake
  356.         CopyToBodyQue (self);
  357.         // get the spawn parms as they were at level start
  358.         setspawnparms (self);
  359.         // respawn
  360.         PutClientInServer ();
  361.     }
  362.     else if (deathmatch)
  363.     {
  364.         // make a copy of the dead body for appearances sake
  365.         CopyToBodyQue (self);
  366.         // set default spawn parms
  367.         SetNewParms ();
  368.         // respawn
  369.         PutClientInServer ();
  370.     }
  371.     else
  372.     {   // restart the entire server
  373.         localcmd ("restart\n");
  374.     }
  375. };
  376.  
  377.  
  378. /*
  379. ============
  380. ClientKill
  381.  
  382. Player entered the suicide command
  383. ============
  384. */
  385. void() ClientKill =
  386. {
  387. // KasCam ->
  388.     if (self == CamClient) {
  389.         return;
  390.     }
  391. // <- KasCam
  392.     bprint (self.netname);
  393.     bprint (" suicides\n");
  394.     set_suicide_frame ();
  395.     self.modelindex = modelindex_player;
  396.     self.frags = self.frags - 2;    // extra penalty
  397.     respawn ();
  398. };
  399.  
  400. float(vector v) CheckSpawnPoint =
  401. {
  402.     return FALSE;
  403. };
  404.  
  405. /*
  406. ============
  407. SelectSpawnPoint
  408.  
  409. Returns the entity to spawn at
  410. ============
  411. */
  412. entity() SelectSpawnPoint =
  413. {
  414.     local   entity spot;
  415.     local   entity thing;
  416.     local   float  pcount;
  417.  
  418. // testinfo_player_start is only found in regioned levels
  419.     spot = find (world, classname, "testplayerstart");
  420.     if (spot)
  421.         return spot;
  422.  
  423. // choose a info_player_deathmatch point
  424.     if (coop)
  425.     {
  426.         lastspawn = find(lastspawn, classname, "info_player_coop");
  427.         if (lastspawn == world)
  428.             lastspawn = find (lastspawn, classname, "info_player_start");
  429.         if (lastspawn != world)
  430.             return lastspawn;
  431.     }
  432.     else if (deathmatch)
  433.     {
  434.         spot = lastspawn;
  435.         while (1)
  436.         {
  437.             spot = find(spot, classname, "info_player_deathmatch");
  438.             if (spot != world)
  439.             {
  440.                 if (spot == lastspawn)
  441.                     return lastspawn;
  442.                 pcount = 0;
  443.                 thing = findradius(spot.origin, 32);
  444.                 while(thing)
  445.                 {
  446.                     if (thing.classname == "player")
  447.                         pcount = pcount + 1;
  448.                     thing = thing.chain;
  449.                 }
  450.                 if (pcount == 0)
  451.                 {
  452.                     lastspawn = spot;
  453.                     return spot;
  454.                 }
  455.             }
  456.         }
  457.     }
  458.  
  459.     if (serverflags)
  460.     {   // return with a rune to start
  461.         spot = find (world, classname, "info_player_start2");
  462.         if (spot)
  463.             return spot;
  464.     }
  465.  
  466.     spot = find (world, classname, "info_player_start");
  467.     if (!spot)
  468.         error ("PutClientInServer: no info_player_start on level");
  469.  
  470.     return spot;
  471. };
  472.  
  473. /*
  474. ===========
  475. PutClientInServer
  476.  
  477. called each time a player is spawned
  478. ============
  479. */
  480. void() DecodeLevelParms;
  481. void() PlayerDie;
  482.  
  483.  
  484. void() PutClientInServer =
  485. {
  486.     local   entity spot;
  487.  
  488.     spot = SelectSpawnPoint ();
  489.  
  490.     self.classname = "player";
  491.     self.health = 100;
  492.     self.takedamage = DAMAGE_AIM;
  493.     self.solid = SOLID_SLIDEBOX;
  494.     self.movetype = MOVETYPE_WALK;
  495.     self.show_hostile = 0;
  496.     self.max_health = 100;
  497.     self.flags = FL_CLIENT;
  498.     self.air_finished = time + 12;
  499.     self.dmg = 2;           // initial water damage
  500.     self.super_damage_finished = 0;
  501.     self.radsuit_finished = 0;
  502.     self.invisible_finished = 0;
  503.     self.invincible_finished = 0;
  504.     self.effects = 0;
  505.     self.invincible_time = 0;
  506.     self.velocity = '0 0 0';
  507.  
  508.     DecodeLevelParms ();
  509.  
  510.     W_SetCurrentAmmo ();
  511.  
  512.     self.attack_finished = time;
  513.     self.th_pain = player_pain;
  514.     self.th_die = PlayerDie;
  515.  
  516.     self.deadflag = DEAD_NO;
  517. // paustime is set by teleporters to keep the player from moving a while
  518.     self.pausetime = 0;
  519.  
  520. //  spot = SelectSpawnPoint ();
  521.  
  522.     self.origin = spot.origin + '0 0 1';
  523.     self.angles = spot.angles;
  524.     self.fixangle = TRUE;       // turn this way immediately
  525.  
  526. // oh, this is a hack!
  527.     setmodel (self, "progs/eyes.mdl");
  528.     modelindex_eyes = self.modelindex;
  529.  
  530.     setmodel (self, "progs/player.mdl");
  531.     modelindex_player = self.modelindex;
  532.  
  533.     setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  534.  
  535.     self.view_ofs = '0 0 22';
  536.  
  537.     player_stand1 ();
  538.  
  539.     if (deathmatch || coop)
  540.     {
  541.         makevectors(self.angles);
  542.         spawn_tfog (self.origin + v_forward*20);
  543.     }
  544.  
  545.     spawn_tdeath (self.origin, self);
  546. };
  547.  
  548.  
  549. /*
  550. =============================================================================
  551.  
  552.                 QUAKED FUNCTIONS
  553.  
  554. =============================================================================
  555. */
  556.  
  557.  
  558. /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
  559. The normal starting point for a level.
  560. */
  561. void() info_player_start =
  562. {
  563. };
  564.  
  565.  
  566. /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
  567. Only used on start map for the return point from an episode.
  568. */
  569. void() info_player_start2 =
  570. {
  571. };
  572.  
  573.  
  574. /*
  575. saved out by quaked in region mode
  576. */
  577. void() testplayerstart =
  578. {
  579. };
  580.  
  581. /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
  582. potential spawning position for deathmatch games
  583. */
  584. void() info_player_deathmatch =
  585. {
  586. };
  587.  
  588. /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
  589. potential spawning position for coop games
  590. */
  591. void() info_player_coop =
  592. {
  593. };
  594.  
  595. /*
  596. ===============================================================================
  597.  
  598. RULES
  599.  
  600. ===============================================================================
  601. */
  602.  
  603. /*
  604. go to the next level for deathmatch
  605. only called if a time or frag limit has expired
  606. */
  607. void() NextLevel =
  608. {
  609.     local entity o;
  610.  
  611.     if (mapname == "start")
  612.     {
  613.         if (!cvar("registered"))
  614.         {
  615.             mapname = "e1m1";
  616.         }
  617.         else if (!(serverflags & 1))
  618.         {
  619.             mapname = "e1m1";
  620.             serverflags = serverflags | 1;
  621.         }
  622.         else if (!(serverflags & 2))
  623.         {
  624.             mapname = "e2m1";
  625.             serverflags = serverflags | 2;
  626.         }
  627.         else if (!(serverflags & 4))
  628.         {
  629.             mapname = "e3m1";
  630.             serverflags = serverflags | 4;
  631.         }
  632.         else if (!(serverflags & 8))
  633.         {
  634.             mapname = "e4m1";
  635.             serverflags = serverflags - 7;
  636.         }
  637.  
  638.         o = spawn();
  639.         o.map = mapname;
  640.     }
  641.     else
  642.     {
  643.         // find a trigger changelevel
  644.         o = find(world, classname, "trigger_changelevel");
  645.  
  646.         // go back to start if no trigger_changelevel
  647.         if (!o)
  648.         {
  649.             mapname = "start";
  650.             o = spawn();
  651.             o.map = mapname;
  652.         }
  653.     }
  654.  
  655.     nextmap = o.map;
  656.     gameover = TRUE;
  657.  
  658.     if (o.nextthink < time)
  659.     {
  660.         o.think = execute_changelevel;
  661.         o.nextthink = time + 0.1;
  662.     }
  663. };
  664.  
  665. /*
  666. ============
  667. CheckRules
  668.  
  669. Exit deathmatch games upon conditions
  670. ============
  671. */
  672. void() CheckRules =
  673. {
  674.     local   float       timelimit;
  675.     local   float       fraglimit;
  676.  
  677.     if (gameover)   // someone else quit the game already
  678.         return;
  679.  
  680.     timelimit = cvar("timelimit") * 60;
  681.     fraglimit = cvar("fraglimit");
  682.  
  683.     if (timelimit && time >= timelimit)
  684.     {
  685.         NextLevel ();
  686.         return;
  687.     }
  688.  
  689.     if (fraglimit && self.frags >= fraglimit)
  690.     {
  691.         NextLevel ();
  692.         return;
  693.     }
  694. };
  695.  
  696. //============================================================================
  697.  
  698. void() PlayerDeathThink =
  699. {
  700.     local entity    old_self;
  701.     local float     forward;
  702.  
  703.     if ((self.flags & FL_ONGROUND))
  704.     {
  705.         forward = vlen (self.velocity);
  706.         forward = forward - 20;
  707.         if (forward <= 0)
  708.             self.velocity = '0 0 0';
  709.         else
  710.         {
  711.             self.velocity = forward * normalize(self.velocity);
  712.         }
  713.     }
  714.  
  715. // wait for all buttons released
  716.     if (self.deadflag == DEAD_DEAD)
  717.     {
  718.         if (self.button2 || self.button1 || self.button0)
  719.             return;
  720.         self.deadflag = DEAD_RESPAWNABLE;
  721.         return;
  722.     }
  723.  
  724. // wait for any button down
  725.     if (!self.button2 && !self.button1 && !self.button0)
  726.         return;
  727.  
  728.     self.button0 = 0;
  729.     self.button1 = 0;
  730.     self.button2 = 0;
  731.     respawn();
  732. };
  733.  
  734.  
  735. void() PlayerJump =
  736. {
  737.     local vector start, end;
  738.  
  739.     if (self.flags & FL_WATERJUMP)
  740.         return;
  741.  
  742.     if (self.waterlevel >= 2)
  743.     {
  744.         if (self.watertype == CONTENT_WATER)
  745.             self.velocity_z = 100;
  746.         else if (self.watertype == CONTENT_SLIME)
  747.             self.velocity_z = 80;
  748.         else
  749.             self.velocity_z = 50;
  750.  
  751. // play swiming sound
  752.         if (self.swim_flag < time)
  753.         {
  754.             self.swim_flag = time + 1;
  755.             if (random() < 0.5)
  756.                 sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  757.             else
  758.                 sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  759.         }
  760.  
  761.         return;
  762.     }
  763.  
  764.     if (!(self.flags & FL_ONGROUND))
  765.         return;
  766.  
  767.     if ( !(self.flags & FL_JUMPRELEASED) )
  768.         return;     // don't pogo stick
  769.  
  770.     self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  771.  
  772.     self.flags = self.flags - FL_ONGROUND;  // don't stairwalk
  773.  
  774.     self.button2 = 0;
  775. // player jumping sound
  776.     sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
  777.     self.velocity_z = self.velocity_z + 270;
  778. };
  779.  
  780.  
  781. /*
  782. ===========
  783. WaterMove
  784.  
  785. ============
  786. */
  787. .float  dmgtime;
  788.  
  789. void() WaterMove =
  790. {
  791. //dprint (ftos(self.waterlevel));
  792.     if (self.movetype == MOVETYPE_NOCLIP)
  793.         return;
  794.     if (self.health < 0)
  795.         return;
  796.  
  797.     if (self.waterlevel != 3)
  798.     {
  799.         if (self.air_finished < time)
  800.             sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  801.         else if (self.air_finished < time + 9)
  802.             sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
  803.         self.air_finished = time + 12;
  804.         self.dmg = 2;
  805.     }
  806.     else if (self.air_finished < time)
  807.     {   // drown!
  808.         if (self.pain_finished < time)
  809.         {
  810.             self.dmg = self.dmg + 2;
  811.             if (self.dmg > 15)
  812.                 self.dmg = 10;
  813.             T_Damage (self, world, world, self.dmg);
  814.             self.pain_finished = time + 1;
  815.         }
  816.     }
  817.  
  818.     if (!self.waterlevel)
  819.     {
  820.         if (self.flags & FL_INWATER)
  821.         {
  822.             // play leave water sound
  823.             sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
  824.             self.flags = self.flags - FL_INWATER;
  825.         }
  826.         return;
  827.     }
  828.  
  829.     if (self.watertype == CONTENT_LAVA)
  830.     {   // do damage
  831.         if (self.dmgtime < time)
  832.         {
  833.             if (self.radsuit_finished > time)
  834.                 self.dmgtime = time + 1;
  835.             else
  836.                 self.dmgtime = time + 0.2;
  837.  
  838.             T_Damage (self, world, world, 10*self.waterlevel);
  839.         }
  840.     }
  841.     else if (self.watertype == CONTENT_SLIME)
  842.     {   // do damage
  843.         if (self.dmgtime < time && self.radsuit_finished < time)
  844.         {
  845.             self.dmgtime = time + 1;
  846.             T_Damage (self, world, world, 4*self.waterlevel);
  847.         }
  848.     }
  849.  
  850.     if ( !(self.flags & FL_INWATER) )
  851.     {
  852.  
  853. // player enter water sound
  854.  
  855.         if (self.watertype == CONTENT_LAVA)
  856.             sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
  857.         if (self.watertype == CONTENT_WATER)
  858.             sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
  859.         if (self.watertype == CONTENT_SLIME)
  860.             sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
  861.  
  862.         self.flags = self.flags + FL_INWATER;
  863.         self.dmgtime = 0;
  864.     }
  865.  
  866.     if (! (self.flags & FL_WATERJUMP) )
  867.         self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
  868. };
  869.  
  870. void() CheckWaterJump =
  871. {
  872.     local vector start, end;
  873.  
  874. // check for a jump-out-of-water
  875.     makevectors (self.angles);
  876.     start = self.origin;
  877.     start_z = start_z + 8;
  878.     v_forward_z = 0;
  879.     normalize(v_forward);
  880.     end = start + v_forward*24;
  881.     traceline (start, end, TRUE, self);
  882.     if (trace_fraction < 1)
  883.     {   // solid at waist
  884.         start_z = start_z + self.maxs_z - 8;
  885.         end = start + v_forward*24;
  886.         self.movedir = trace_plane_normal * -50;
  887.         traceline (start, end, TRUE, self);
  888.         if (trace_fraction == 1)
  889.         {   // open at eye level
  890.             self.flags = self.flags | FL_WATERJUMP;
  891.             self.velocity_z = 225;
  892.             self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  893.             self.teleport_time = time + 2;  // safety net
  894.             return;
  895.         }
  896.     }
  897. };
  898.  
  899.  
  900. /*
  901. ================
  902. PlayerPreThink
  903.  
  904. Called every frame before physics are run
  905. ================
  906. */
  907. void() PlayerPreThink =
  908. {
  909.     local   float   mspeed, aspeed;
  910.     local   float   r;
  911.  
  912.     if (intermission_running)
  913.     {
  914.         IntermissionThink ();   // otherwise a button could be missed between
  915.         return;                 // the think tics
  916.     }
  917.  
  918.     if (self.view_ofs == '0 0 0')
  919.         return;     // intermission or finale
  920.  
  921.     makevectors (self.v_angle);     // is this still used
  922.  
  923.     CheckRules ();
  924.     WaterMove ();
  925.  
  926.     if (self.waterlevel == 2)
  927.         CheckWaterJump ();
  928.  
  929.     if (self.deadflag >= DEAD_DEAD)
  930.     {
  931.         PlayerDeathThink ();
  932.         return;
  933.     }
  934.  
  935.     if (self.deadflag == DEAD_DYING)
  936.         return; // dying, so do nothing
  937.  
  938.     if (self.button2)
  939.     {
  940.         PlayerJump ();
  941.     }
  942.     else
  943.         self.flags = self.flags | FL_JUMPRELEASED;
  944.  
  945. // teleporters can force a non-moving pause time
  946.     if (time < self.pausetime)
  947.         self.velocity = '0 0 0';
  948.  
  949.     if(time > self.attack_finished && self.currentammo == 0 && self.weapon != IT_AXE)
  950.     {
  951.         self.weapon = W_BestWeapon ();
  952.         W_SetCurrentAmmo ();
  953.     }
  954. };
  955.  
  956. /*
  957. ================
  958. CheckPowerups
  959.  
  960. Check for turning off powerups
  961. ================
  962. */
  963. void() CheckPowerups =
  964. {
  965.     if (self.health <= 0)
  966.         return;
  967.  
  968. // invisibility
  969.     if (self.invisible_finished)
  970.     {
  971. // sound and screen flash when items starts to run out
  972.         if (self.invisible_sound < time)
  973.         {
  974.             sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
  975.             self.invisible_sound = time + ((random() * 3) + 1);
  976.         }
  977.  
  978.  
  979.         if (self.invisible_finished < time + 3)
  980.         {
  981.             if (self.invisible_time == 1)
  982.             {
  983.                 sprint (self, "Ring of Shadows magic is fading\n");
  984.                 stuffcmd (self, "bf\n");
  985.                 sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
  986.                 self.invisible_time = time + 1;
  987.             }
  988.  
  989.             if (self.invisible_time < time)
  990.             {
  991.                 self.invisible_time = time + 1;
  992.                 stuffcmd (self, "bf\n");
  993.             }
  994.         }
  995.  
  996.         if (self.invisible_finished < time)
  997.         {   // just stopped
  998.             self.items = self.items - IT_INVISIBILITY;
  999.             self.invisible_finished = 0;
  1000.             self.invisible_time = 0;
  1001.         }
  1002.  
  1003.     // use the eyes
  1004.         self.frame = 0;
  1005.         self.modelindex = modelindex_eyes;
  1006.     }
  1007.     else
  1008.         self.modelindex = modelindex_player;    // don't use eyes
  1009.  
  1010. // invincibility
  1011.     if (self.invincible_finished)
  1012.     {
  1013. // sound and screen flash when items starts to run out
  1014.         if (self.invincible_finished < time + 3)
  1015.         {
  1016.             if (self.invincible_time == 1)
  1017.             {
  1018.                 sprint (self, "Protection is almost burned out\n");
  1019.                 stuffcmd (self, "bf\n");
  1020.                 sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
  1021.                 self.invincible_time = time + 1;
  1022.             }
  1023.  
  1024.             if (self.invincible_time < time)
  1025.             {
  1026.                 self.invincible_time = time + 1;
  1027.                 stuffcmd (self, "bf\n");
  1028.             }
  1029.         }
  1030.  
  1031.         if (self.invincible_finished < time)
  1032.         {   // just stopped
  1033.             self.items = self.items - IT_INVULNERABILITY;
  1034.             self.invincible_time = 0;
  1035.             self.invincible_finished = 0;
  1036.         }
  1037.         if (self.invincible_finished > time)
  1038.             self.effects = self.effects | EF_DIMLIGHT;
  1039.         else
  1040.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1041.     }
  1042.  
  1043. // super damage
  1044.     if (self.super_damage_finished)
  1045.     {
  1046.  
  1047. // sound and screen flash when items starts to run out
  1048.  
  1049.         if (self.super_damage_finished < time + 3)
  1050.         {
  1051.             if (self.super_time == 1)
  1052.             {
  1053.                 sprint (self, "Quad Damage is wearing off\n");
  1054.                 stuffcmd (self, "bf\n");
  1055.                 sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
  1056.                 self.super_time = time + 1;
  1057.             }
  1058.  
  1059.             if (self.super_time < time)
  1060.             {
  1061.                 self.super_time = time + 1;
  1062.                 stuffcmd (self, "bf\n");
  1063.             }
  1064.         }
  1065.  
  1066.         if (self.super_damage_finished < time)
  1067.         {   // just stopped
  1068.             self.items = self.items - IT_QUAD;
  1069.             self.super_damage_finished = 0;
  1070.             self.super_time = 0;
  1071.         }
  1072.         if (self.super_damage_finished > time)
  1073.             self.effects = self.effects | EF_DIMLIGHT;
  1074.         else
  1075.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1076.     }
  1077.  
  1078. // suit
  1079.     if (self.radsuit_finished)
  1080.     {
  1081.         self.air_finished = time + 12;      // don't drown
  1082.  
  1083. // sound and screen flash when items starts to run out
  1084.         if (self.radsuit_finished < time + 3)
  1085.         {
  1086.             if (self.rad_time == 1)
  1087.             {
  1088.                 sprint (self, "Air supply in Biosuit expiring\n");
  1089.                 stuffcmd (self, "bf\n");
  1090.                 sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
  1091.                 self.rad_time = time + 1;
  1092.             }
  1093.  
  1094.             if (self.rad_time < time)
  1095.             {
  1096.                 self.rad_time = time + 1;
  1097.                 stuffcmd (self, "bf\n");
  1098.             }
  1099.         }
  1100.  
  1101.         if (self.radsuit_finished < time)
  1102.         {   // just stopped
  1103.             self.items = self.items - IT_SUIT;
  1104.             self.rad_time = 0;
  1105.             self.radsuit_finished = 0;
  1106.         }
  1107.     }
  1108.  
  1109. };
  1110.  
  1111.  
  1112. /*
  1113. ================
  1114. PlayerPostThink
  1115.  
  1116. Called every frame after physics are run
  1117. ================
  1118. */
  1119. void() PlayerPostThink =
  1120. {
  1121.     local   float   mspeed, aspeed;
  1122.     local   float   r;
  1123.  
  1124. // KasCam ->
  1125.     if ((self == CamClient) && !intermission_running)
  1126.     {
  1127.         CamThink();
  1128.         return;
  1129.     }
  1130. // <- KasCam
  1131.  
  1132.     if (self.view_ofs == '0 0 0')
  1133.         return;
  1134.  
  1135.     if (self.deadflag)
  1136.         return;
  1137.  
  1138. // do weapon stuff
  1139.  
  1140.     W_WeaponFrame ();
  1141.  
  1142. // check to see if player landed and play landing sound
  1143.     if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
  1144.     {
  1145.         if (self.watertype == CONTENT_WATER)
  1146.             sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  1147.         else if (self.jump_flag < -650)
  1148.         {
  1149.             T_Damage (self, world, world, 5);
  1150.             sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  1151.             self.deathtype = "falling";
  1152.         }
  1153.         else
  1154.             sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  1155.  
  1156.         self.jump_flag = 0;
  1157.     }
  1158.  
  1159.     if (!(self.flags & FL_ONGROUND))
  1160.         self.jump_flag = self.velocity_z;
  1161.  
  1162.     CheckPowerups ();
  1163. };
  1164.  
  1165.  
  1166. /*
  1167. ===========
  1168. ClientConnect
  1169.  
  1170. called when a player connects to a server
  1171. ============
  1172. */
  1173. void() ClientConnect =
  1174. {
  1175. // KasCam ->
  1176.     if ((self.netname == "CamClient") && (CamClient == world))
  1177.     {
  1178.         self.impulse = 250;
  1179.     }
  1180.     else
  1181.     {
  1182.         bprint (self.netname);
  1183.         bprint (" entered the game\n");
  1184.     }
  1185. // <- KasCam
  1186. // a client connecting during an intermission can cause problems
  1187.     if (intermission_running)
  1188.         ExitIntermission ();
  1189. };
  1190.  
  1191.  
  1192. /*
  1193. ===========
  1194. ClientDisconnect
  1195.  
  1196. called when a player disconnects from a server
  1197. ============
  1198. */
  1199. void() ClientDisconnect =
  1200. {
  1201.     if (gameover)
  1202.         return;
  1203.     // if the level end trigger has been activated, just return
  1204.     // since they aren't *really* leaving
  1205.  
  1206.     // let everyone else know
  1207. // KasCam ->
  1208.     if (CamClient == self)
  1209.     {
  1210.         CamClient = world;
  1211.         bprint("Camera Deactivated\n");
  1212.     }
  1213.     else
  1214.     {
  1215.         bprint (self.netname);
  1216.         bprint (" left the game with ");
  1217.         bprint (ftos(self.frags));
  1218.         bprint (" frags\n");
  1219.         sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  1220.         set_suicide_frame ();
  1221.         if (CamTargEnt == self)
  1222.         {
  1223.             CamState = CAM_IDLE;
  1224.             CamNextThink = time + 2;
  1225.         }
  1226.     }
  1227. // <- KasCam
  1228. };
  1229.  
  1230. /*
  1231. ===========
  1232. ClientObituary
  1233.  
  1234. called when a player dies
  1235. ============
  1236. */
  1237. void(entity targ, entity attacker) ClientObituary =
  1238. {
  1239.     local   float rnum;
  1240.     local   string deathstring, deathstring2;
  1241.     rnum = random();
  1242.  
  1243.     if (targ.classname == "player")
  1244.     {
  1245.         if (attacker.classname == "teledeath")
  1246.         {
  1247.             bprint (targ.netname);
  1248.             bprint (" was telefragged by ");
  1249.             bprint (attacker.owner.netname);
  1250.             bprint ("\n");
  1251.  
  1252.             attacker.owner.frags = attacker.owner.frags + 1;
  1253.             return;
  1254.         }
  1255.  
  1256.         if (attacker.classname == "teledeath2")
  1257.         {
  1258.             bprint ("Satan's power deflects ");
  1259.             bprint (targ.netname);
  1260.             bprint ("'s telefrag\n");
  1261.  
  1262.             targ.frags = targ.frags - 1;
  1263.             return;
  1264.         }
  1265.  
  1266.         if (attacker.classname == "player")
  1267.         {
  1268.             if (targ == attacker)
  1269.             {
  1270.                 // killed self
  1271.                 attacker.frags = attacker.frags - 1;
  1272.                 bprint (targ.netname);
  1273.  
  1274.                 if (targ.weapon == 64 && targ.waterlevel > 1)
  1275.                 {
  1276.                     bprint (" discharges into the water.\n");
  1277.                     return;
  1278.                 }
  1279.                 if (targ.weapon == IT_GRENADE_LAUNCHER)
  1280.                     bprint (" tries to put the pin back in\n");
  1281.                 else
  1282.                     bprint (" becomes bored with life\n");
  1283.                 return;
  1284.             }
  1285.             else if ( (teamplay == 2) && (targ.team > 0)&&(targ.team == attacker.team) )
  1286.             {
  1287.                 if (rnum < 0.25)
  1288.                     deathstring = " mows down a teammate\n";
  1289.                 else if (rnum < 0.50)
  1290.                     deathstring = " checks his glasses\n";
  1291.                 else if (rnum < 0.75)
  1292.                     deathstring = " gets a frag for the other team\n";
  1293.                 else
  1294.                     deathstring = " loses another friend\n";
  1295.                 bprint (attacker.netname);
  1296.                 bprint (deathstring);
  1297.                 attacker.frags = attacker.frags - 1;
  1298.                 return;
  1299.             }
  1300.             else
  1301.             {
  1302.                 attacker.frags = attacker.frags + 1;
  1303.  
  1304.                 rnum = attacker.weapon;
  1305.                 if (rnum == IT_AXE)
  1306.                 {
  1307.                     deathstring = " was ax-murdered by ";
  1308.                     deathstring2 = "\n";
  1309.                 }
  1310.                 if (rnum == IT_SHOTGUN)
  1311.                 {
  1312.                     deathstring = " chewed on ";
  1313.                     deathstring2 = "'s boomstick\n";
  1314.                 }
  1315.                 if (rnum == IT_SUPER_SHOTGUN)
  1316.                 {
  1317.                     deathstring = " ate 2 loads of ";
  1318.                     deathstring2 = "'s buckshot\n";
  1319.                 }
  1320.                 if (rnum == IT_NAILGUN)
  1321.                 {
  1322.                     deathstring = " was nailed by ";
  1323.                     deathstring2 = "\n";
  1324.                 }
  1325.                 if (rnum == IT_SUPER_NAILGUN)
  1326.                 {
  1327.                     deathstring = " was punctured by ";
  1328.                     deathstring2 = "\n";
  1329.                 }
  1330.                 if (rnum == IT_GRENADE_LAUNCHER)
  1331.                 {
  1332.                     deathstring = " eats ";
  1333.                     deathstring2 = "'s pineapple\n";
  1334.                     if (targ.health < -40)
  1335.                     {
  1336.                         deathstring = " was gibbed by ";
  1337.                         deathstring2 = "'s grenade\n";
  1338.                     }
  1339.                 }
  1340.                 if (rnum == IT_ROCKET_LAUNCHER)
  1341.                 {
  1342.                     deathstring = " rides ";
  1343.                     deathstring2 = "'s rocket\n";
  1344.                     if (targ.health < -40)
  1345.                     {
  1346.                         deathstring = " was gibbed by ";
  1347.                         deathstring2 = "'s rocket\n" ;
  1348.                     }
  1349.                 }
  1350.                 if (rnum == IT_LIGHTNING)
  1351.                 {
  1352.                     deathstring = " accepts ";
  1353.                     if (attacker.waterlevel > 1)
  1354.                         deathstring2 = "'s discharge\n";
  1355.                     else
  1356.                         deathstring2 = "'s shaft\n";
  1357.                 }
  1358.                 bprint (targ.netname);
  1359.                 bprint (deathstring);
  1360.                 bprint (attacker.netname);
  1361.                 bprint (deathstring2);
  1362.             }
  1363.             return;
  1364.         }
  1365.         else
  1366.         {
  1367.             targ.frags = targ.frags - 1;
  1368.             bprint (targ.netname);
  1369.  
  1370.             // killed by a montser?
  1371.             if (attacker.flags & FL_MONSTER)
  1372.             {
  1373.                 if (attacker.classname == "monster_army")
  1374.                     bprint (" was shot by a Grunt\n");
  1375.                 if (attacker.classname == "monster_demon1")
  1376.                     bprint (" was eviscerated by a Fiend\n");
  1377.                 if (attacker.classname == "monster_dog")
  1378.                     bprint (" was mauled by a Rottweiler\n");
  1379.                 if (attacker.classname == "monster_dragon")
  1380.                     bprint (" was fried by a Dragon\n");
  1381.                 if (attacker.classname == "monster_enforcer")
  1382.                     bprint (" was blasted by an Enforcer\n");
  1383.                 if (attacker.classname == "monster_fish")
  1384.                     bprint (" was fed to the Rotfish\n");
  1385.                 if (attacker.classname == "monster_hell_knight")
  1386.                     bprint (" was slain by a Death Knight\n");
  1387.                 if (attacker.classname == "monster_knight")
  1388.                     bprint (" was slashed by a Knight\n");
  1389.                 if (attacker.classname == "monster_ogre")
  1390.                     bprint (" was destroyed by an Ogre\n");
  1391.                 if (attacker.classname == "monster_oldone")
  1392.                     bprint (" became one with Shub-Niggurath\n");
  1393.                 if (attacker.classname == "monster_shalrath")
  1394.                     bprint (" was exploded by a Vore\n");
  1395.                 if (attacker.classname == "monster_shambler")
  1396.                     bprint (" was smashed by a Shambler\n");
  1397.                 if (attacker.classname == "monster_tarbaby")
  1398.                     bprint (" was slimed by a Spawn\n");
  1399.                 if (attacker.classname == "monster_vomit")
  1400.                     bprint (" was vomited on by a Vomitus\n");
  1401.                 if (attacker.classname == "monster_wizard")
  1402.                     bprint (" was scragged by a Scrag\n");
  1403.                 if (attacker.classname == "monster_zombie")
  1404.                     bprint (" joins the Zombies\n");
  1405.  
  1406.                 return;
  1407.             }
  1408.  
  1409.             // tricks and traps
  1410.             if (attacker.classname == "explo_box")
  1411.             {
  1412.                 bprint (" blew up\n");
  1413.                 return;
  1414.             }
  1415.             if (attacker.solid == SOLID_BSP && attacker != world)
  1416.             {
  1417.                 bprint (" was squished\n");
  1418.                 return;
  1419.             }
  1420.             if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
  1421.             {
  1422.                 bprint (" was spiked\n");
  1423.                 return;
  1424.             }
  1425.             if (attacker.classname == "fireball")
  1426.             {
  1427.                 bprint (" ate a lavaball\n");
  1428.                 return;
  1429.             }
  1430.             if (attacker.classname == "trigger_changelevel")
  1431.             {
  1432.                 bprint (" tried to leave\n");
  1433.                 return;
  1434.             }
  1435.  
  1436.             // in-water deaths
  1437.             rnum = targ.watertype;
  1438.             if (rnum == -3)
  1439.             {
  1440.                 if (random() < 0.5)
  1441.                     bprint (" sleeps with the fishes\n");
  1442.                 else
  1443.                     bprint (" sucks it down\n");
  1444.                 return;
  1445.             }
  1446.             else if (rnum == -4)
  1447.             {
  1448.                 if (random() < 0.5)
  1449.                     bprint (" gulped a load of slime\n");
  1450.                 else
  1451.                     bprint (" can't exist on slime alone\n");
  1452.                 return;
  1453.             }
  1454.             else if (rnum == -5)
  1455.             {
  1456.                 if (targ.health < -15)
  1457.                 {
  1458.                     bprint (" burst into flames\n");
  1459.                     return;
  1460.                 }
  1461.                 if (random() < 0.5)
  1462.                     bprint (" turned into hot slag\n");
  1463.                 else
  1464.                     bprint (" visits the Volcano God\n");
  1465.                 return;
  1466.             }
  1467.  
  1468.             // fell to their death?
  1469.             if (targ.deathtype == "falling")
  1470.             {
  1471.                 targ.deathtype = "";
  1472.                 bprint (" fell to his death\n");
  1473.                 return;
  1474.             }
  1475.  
  1476.             // hell if I know; he's just dead!!!
  1477.             bprint (" died\n");
  1478.         }
  1479.     }
  1480. };
  1481.